//
//  NavigationBarView.m
//  基本框架
//
//  Created by runone02 on 2018/8/3.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "NavigationBarView.h"

@implementation NavigationBarView


- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
        
    self.imageView = [[UIImageView alloc]init];
    self.imageView.backgroundColor = RGBA(24, 189, 250, 1);
    self.imageView.userInteractionEnabled = YES;
    [self addSubview:self.imageView];
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.mas_equalTo(self);
    }];
        self.backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.backBtn setImage:IMAGE(@"back") forState:UIControlStateNormal];
    self.backBtn.backgroundColor = [UIColor redColor];
        [self.backBtn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
        self.shareBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.shareBtn setImage:IMAGE(@"share") forState:UIControlStateNormal];
    self.shareBtn.backgroundColor = [UIColor redColor];
        [self.shareBtn setImage:IMAGE(@"share_back") forState:UIControlStateSelected];
        [self.shareBtn addTarget:self action:@selector(shareBtnAction) forControlEvents:UIControlEventTouchUpInside];
        self.collectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.collectBtn addTarget:self action:@selector(collectButtonAction) forControlEvents:UIControlEventTouchUpInside];
        [self.collectBtn setImage:IMAGE(@"shoucang") forState:UIControlStateNormal];
    self.collectBtn.backgroundColor = [UIColor redColor];
        [self.collectBtn setImage:IMAGE(@"shoucang_s") forState:UIControlStateSelected];
    
        [self.imageView addSubview:self.backBtn];
        [self.imageView addSubview:self.shareBtn];
        [self.imageView addSubview:self.collectBtn];
    
        [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.imageView).offset(10);
            make.top.equalTo(self.imageView).offset(35);
            make.size.mas_equalTo(CGSizeMake(22, 22));
        }];
    
        [self.shareBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.backBtn);
            make.right.equalTo(self.imageView).offset(-73);
            make.size.mas_offset(CGSizeMake(22, 22));
        }];
    
        [self.collectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.backBtn);
            make.right.equalTo(self.imageView).offset(-30);
            make.size.mas_equalTo(CGSizeMake(22, 22));
        }];
}

- (void)back{
    [self.viewController.navigationController popViewControllerAnimated:YES];
}

- (void)shareBtnAction{
    NSLog(@"分享");
}

- (void)collectButtonAction{
    NSLog(@"收藏");
}
@end
